﻿<%@ Page Language="C#" AutoEventWireup="true" Buffer="false" CodeBehind="DesktopMain.aspx.cs"
    Inherits="ZX.WebApp.DeskTop.Form.DesktopMain" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="/ExtendPage/Template/matrix-1/css/bootstrap.min.css" rel="stylesheet"
        type="text/css" />
    <link rel="stylesheet" href="/ExtendPage/Template/matrix-1/css/bootstrap-responsive.min.css" />
    <link rel="stylesheet" href="/ExtendPage/Template/matrix-1/css/matrix-style.css" />
    <link rel="stylesheet" href="/ExtendPage/Template/matrix-1/css/matrix-media.css" />
    <link href="/ExtendPage/Template/matrix-1/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <style>
        .tab-pane
        {
            padding: 2px;
        }
        .tableContent
        {
            margin: 0px;
            padding: 0px;
            width: 100%;
            font-size: 12px;
        }
        .tableContent th
        {
            font: bold 10px "Trebuchet MS" , Verdana, Arial, Helvetica, sans-serif;
            color: Black; /*color: #4f6b72;*/ /*border-left: 1px solid #C1DAD7;*/
            border-right: 1px solid #C1DAD7;
            border-bottom: 1px solid #C1DAD7;
            border-top: 1px solid #C1DAD7;
            letter-spacing: 2px;
            text-transform: uppercase;
            text-align: left;
            padding: 6px 6px 6px 1px; /*background: #CAE8EA no-repeat;*/
            background: #e0ecff no-repeat;
        }
        .tableContent td
        {
            border-right: 1px solid #C1DAD7;
            border-bottom: 1px solid #C1DAD7;
            background: #fff;
            font-size: 11px;
            padding: 6px 6px 6px 1px; /*color: #4f6b72;*/
            color: Black;
        }
        
        a:visited
        {
            color: Blue;
            text-decoration: none;
        }
        a:hover
        {
            color: Blue;
            text-decoration: none;
        }
        a:link
        {
            color: Blue;
            text-decoration: none;
        }
        a:active
        {
            color: Blue;
            text-decoration: none;
        }
    </style>
</head>
<body style="background-color: #fff">
    <form id="form1" runat="server">
    <div class="container-fluid">
        <div class="quick-actions_homepage">
            <ul class="quick-actions" id="Shortcut">
<%--            <li class="bg_lb"><a href="#" url=""><i class="icon-dashboard"></i><span class="label label-important">
                    20</span>排名</a> </li>
                <li class="bg_lg"><a href="#" url=""><i class="icon-signal"></i>报表</a> </li>
                <li class="bg_ly"><a href="#" url=""><i class="icon-inbox"></i><span class="label label-success">
                    101</span>任务</a> </li>
                <li class="bg_lo"><a href="#" url=""><i class="icon-th"></i>功能</a> </li>
                <li class="bg_ls"><a href="#" url=""><i class="icon-fullscreen"></i>数据</a> </li>
                <li class="bg_lo"><a href="#" url=""><i class="icon-th-list"></i>设置</a>
                </li>
                <li class="bg_ls"><a href="#" url=""><i class="icon-tint"></i>Buttons</a> </li>
                <li class="bg_lb"><a href="#" url=""><i class="icon-pencil"></i>Elements</a>
                </li>
                <li class="bg_lg"><a href="#" url=""><i class="icon-calendar"></i>日程表</a> </li>
                <li class="bg_lr"><a href="#" url=""><i class="icon-info-sign"></i>提示</a> </li>--%>
            </ul>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span7" style="margin-left: 5px;" id="custom_clum_left">
        </div>
        <div class="span5" style="margin-left: 10px;" id="custom_clum_right">
        </div>
    </div>
    <!--主体 开始-->
    <!--主体 结束-->
    </form>
</body>
</html>
<script src="/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="/ExtendPage/Template/matrix-1/js/jquery.ui.custom.js" type="text/javascript"></script>
<script src="/ExtendPage/Template/matrix-1/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/ExtendPage/Template/matrix-1/js/matrix.interface.js" type="text/javascript"></script>
<script src="/Scripts/jquery.data.js" type="text/javascript"></script>

<script language="javascript" type="text/javascript">
    var colors = ["bg_lb", "bg_db", "bg_lg", "bg_ly", "bg_dy", "bg_lb", "bg_ls", "bg_lo", "bg_lr", "bg_lv"];
//    .bg_lb{ background:#27a9e3;}
//.bg_db{ background:#2295c9;}
//.bg_lg{ background:#28b779;}
//.bg_dg{ background:#28b779;}
//.bg_ly{ background:#ffb848;}
//.bg_dy{ background:#da9628;}
//.bg_ls{ background:#2255a4;}
//.bg_lo{ background:#da542e;}
//.bg_lr{ background:#f74d4d;}
//.bg_lv{ background:#603bbc;}
//.bg_lh{ background:#b6b3b3;}
    var InitDeskTop = function () {
        //debugger
        var _data = fnGetData("V_Set_Shortcut", "AddUser='" + parent._currentUserID + "'", "Sort");
        if (_data != null) {
            for (var i = 0; i < _data.rows.length; i++) {

                var strTemplate = '<li class="' + colors[i%10]+
                /*(_data.rows[i].PanelStyle == "" ? "bg_ls" : _data.rows[i].PanelStyle) +
                /* '" style="background:' + _data.rows[i].BackgroudColor + */
                '"><a href="#" url="' + _data.rows[i].URL + '&functionid=' + _data.rows[i].FunctionID + '"><i class="icon-tablet"></i>' + _data.rows[i].Name + '</a> </li>';
                $("#Shortcut").append(strTemplate);
            }
        }
        $("#Shortcut >li >a").click(function (e) {
            parent.addTabs($(this).text(), $(this).attr("url"),"");
        });
    }
    InitDeskTop();
</script>

<script language="javascript" type="text/javascript">


    //debugger
    var _template = '<div class="widget-box">' +
          '<div class="widget-title bg_ly" data-toggle="collapse" href="#[i]"><span class="icon"><i class="icon-chevron-down"></i></span>' +
          '<h5>[title]</h5>' +
          '</div>' +
          '<div class="widget-content nopadding collapse in" id="[id]">' +
           '<div>[content]</div>' +
            '<ul class="recent-posts">' +
            '<li>' +
                '<button class="btn btn-warning btn-mini">View All</button>' +
              '</li>' +
            '</ul>' +
          '</div>' +
        '</div>';

    var _tabtemplate_title = '<div class="widget-title">' +
                    '<ul class="nav nav-tabs">' +
                        '[nav]' +
                    '</ul>' +
                '</div>';
    var _tabtemplate_content = '<div class="widget-content tab-content nopadding collapse in">[content]</div>';

    var DeskTop = {
        data: {},
        custom_clum_left: $("#custom_clum_left"), //左边容器
        custom_clum_right: $("#custom_clum_right") //右边容器
    };
    //依赖于jquery.data.js
    DeskTop.getData = function () {
        DeskTop.data = eval("(" + getUrlData("DesktopMain.aspx?Action=LoadData&r=" + Math.random()) + ")");
    }
    //初始栏目
    var __i = 0;
    DeskTop.initColumn = function () {
        var data = DeskTop.data;
        //for (var i = 0; i < data.length; i++) {


        //}
        fnBuildItem(data[0],__i);
    }

    function fnBuildItem(o) {
        if (o == null) {
            return;
        }
        if (typeof (o) == undefined) {
            return;
        }
        __i = __i + 1;
        var e = o;
        if (e.tools != "") {
            //debugger
            var li = $(e.tools);
            _len = li.length;
            if (e.tools.indexOf("更多") > 0) {
                _len -= _len;
            }
            if (_len == 0) {
                if (e.pageType == 1) {
                    _datatemp = "<iframe scrolling=\"auto\" frameborder=\"0\"  src=\"" + e.src + "\" style=\"width:100%;height:100%; margin:0px;\"></iframe>";
                } else {
                    _datatemp = getUrlData(e.src);
                }
                //var _datatemp = getUrlData(e.src);
                var html = _template.replace("[title]", e.title).replace("[content]", _datatemp);
                if (e.Region == "right") {
                    $(html).appendTo(this.custom_clum_right);
                }
                else {
                    $(html).appendTo(this.custom_clum_left);
                }

            } else {
                ///debugger
                var _tabLiHtml = "", _tabContentHtml = "";
                for (var index = 0; index < _len; index++) {
                    var _tabId = e.id + '_' + index;

                    if (li[index].className == undefined) {
                        continue;
                    }
                    var _li = ('<li class="active"><a data-toggle="tab" href="#' + _tabId + '">' + $(li[index]).text() + '</a></li>').replace('active', (index != 0 ? "" : "active"));
                    _tabLiHtml += _li;
                    var _datatemp = '';
                    if (e.pageType == 1) {
                        _datatemp = "<iframe scrolling=\"auto\" frameborder=\"0\"  src=\"" + ($(li[index]).attr("TabUrl") + "?" + $(li[index]).attr("TabPro")) + "\" style=\"width:100%;height:100%; margin:0px;\"></iframe>";
                    } else {
                        _datatemp = getUrlData($(li[index]).attr("TabUrl") + "?" + $(li[index]).attr("TabPro"));
                    }
                    _tabContentHtml += ('<div id="' + _tabId + '" class="tab-pane active nopadding">' + _datatemp + '</div>').replace('active', (index != 0 ? "" : "active"));
                }
                var __tabtemplate_title = _tabtemplate_title.replace("[nav]", _tabLiHtml);
                var __tabtemplate_content = _tabtemplate_content.replace("[content]", _tabContentHtml);
                var html = '<div class="widget-box">' + __tabtemplate_title + __tabtemplate_content + '</div>';
                if (e.Region == "right") {
                    $(html).appendTo(this.custom_clum_right);
                }
                else {
                    $(html).appendTo(this.custom_clum_left);
                }
            }
        }
        else {
            //                var _datatemp = getUrlData(e.src);
            //                var html = _template.replace("[title]", e.title).replace("[content]", _datatemp);
            //                if (e.Region == "right") {
            //                    $(html).appendTo(this.custom_clum_right);
            //                }
            //                else {
            //                    $(html).appendTo(this.custom_clum_left);
            //                }
            var html = _template.replace("[title]", e.title);
            var _targetEml = e.Region == "right" ? this.custom_clum_right : this.custom_clum_left;
            //getUrlData2(e.src, html, _targetEml);
        }
        if (__i <= DeskTop.data.length - 1) {
            if ((typeof (DeskTop.data[__i]) != "undefined")) {
                setTimeout(fnBuildItem(DeskTop.data[__i], __i), 100);
            }
        }
    }





    /*----------------------------------------*/
    DeskTop.getData();
    DeskTop.initColumn();
    /*----------------------------------------*/
    function getUrlData2(url, _template, targetEml) {
        $.ajax({
            type: 'post',
            dataType: "text",
            async: true,
            url: url,
            //data: parm,
            cache: false,
            async: false,
            success: function (data) {
                //debugger
                var html = _template.replace("[content]", data)
                $(html).appendTo(targetEml);
            }
        });
    }
    function getUrlData(url, html, callBack, c) {
        _data = '';
        $.ajax({
            type: 'post',
            dataType: "text",
            async: false,
            url: url,
            //data: parm,
            cache: false,
            async: false,
            success: function (data) {
                //debugger
                _data = data;
            }
        });
        return _data;
    }

    var unDone = function () {
        parent.parent.addTabs("待办任务", "../Extend/YUIList.aspx?entity=V_HF_TaskInstanceView&functionID=17eae1ad-6f95-44bb-a231-3bfb8276ae81&order=taskStartTime desc");
    }

    var fnOpenDetail = function () {
        parent.parent.addTabs("考勤确认", "../Extend/YUIDataTableList.aspx?entity=V_wkWorkResult&order=WorkDate desc&functionID=46b2b874-c1ce-4807-a5f1-5a08b57699b3&condition=IsValidate='N' and WkStatus not in ('正常出勤','非工作日','项目中','加班')");
    }

    var fnOpenDetailLocation = function () {
        window.location = "../../Extend/YUIDataTableList.aspx?entity=V_wkWorkResult&order=WorkDate desc&functionID=46b2b874-c1ce-4807-a5f1-5a08b57699b3&condition=IsValidate='N' and WkStatus not in ('正常出勤','非工作日','项目中','加班')";
    }

    var ShowAnnounce = function (title, announceId) {
        parent.addTabs
        parent.parent.addTabs(title, "http://" + this.location.host + "/EditWidows/SysManager/ShowAnnounce.aspx?ID=" + announceId + "&r=" + Math.random() + "");
    }
    var fn_ShowMoreMessage = function () {
        parent.parent.addTabs("更多消息", "../Extend/YUIList.aspx?entity=V_Message&order=SendTime desc&functionID=3fa9d909-c7c1-4dae-91a7-be904d4d905e");
    }
    var fn_ShowHistoryMessage = function () {
        parent.parent.addTabs("查看历史消息", "../Extend/YUIList.aspx?entity=V_MessageHistory&order=SendTime desc&functionID=3fa9d909-c7c1-4dae-91a7-be904d4d905e");
    }

    var ViewDeptChart = function () {
        var url = "../Extend/Reports/hrDeskReports.aspx?flag=deptEmpCount&r=" + Math.random();
        var pagetitle = "在职人数统计";
        parent.parent.addTabs(pagetitle, url);
        parent.parent.NeedRefreshPage = this;
    }
</script>
